<!DOCTYPE html>
<html lang="zh_CN" xmlns:th="http://www.thymeleaf.org">
<head th:fragment="head">
	<base th:href="@{/}">
	<meta charset="utf-8">
	<title>新增</title>
	<meta name="renderer" content="webkit">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
	<meta name="apple-mobile-web-app-status-bar-style" content="black">
	<meta name="apple-mobile-web-app-capable" content="yes">
	<meta name="format-detection" content="telephone=no">
	<link rel="stylesheet" href="static/layui/css/layui.css" media="all" />
	<link rel="stylesheet" type="text/css" href="static/jquery-easyui/themes/default/easyui.css">
	<script type="text/javascript" src="static/jquery-easyui/jquery.min.js"></script>
	<script type="text/javascript" src="static/jquery-easyui/jquery.easyui.min.js"></script>
	<script type="text/javascript" src="static/jquery-easyui/locale/easyui-lang-zh_CN.js"></script> 
	<script type="text/javascript" src="static/layui/layui.js"></script>
	<style type="text/css">
		.layui-form-label {
		    white-space: nowrap;
		    width: 110px;
		    color: gray;
		}
	</style>
</head>
<body class="layui-fluid" th:fragment="body">
	<div class="layui-row">
		<div class="layui-col-md6 layui-col-md-offset3">
			<form class="easyui-form" id="form" action="" autocomplete="off" style="padding-top: 1px;" data-options="novalidate:true">
				<div class="layui-form-item">
					<div class="layui-inline">
						<label class="layui-form-label">客户</label>
						<div class="layui-input-inline">
							<input id="customerId" name="customerId" class="easyui-combobox" data-options="required:true,valueField: 'code',textField: 'name',url:'manage/selectList/customerList',prompt:'请选择',missingMessage:'请选择'">
						</div>
					</div>
				</div>
				<div class="layui-form-item">
					<div class="layui-inline">
						<label class="layui-form-label">产品</label>
						<div class="layui-input-inline">
							<input id="productId" name="productId" class="easyui-combobox" data-options="required:true,valueField: 'code',textField: 'code',url:'manage/selectList/productList',prompt:'请选择',missingMessage:'请选择'">
						</div>
					</div>
				</div>
				<div class="layui-form-item" style="margin-top: 20px;">
					<div class="layui-inline">
						<label class="layui-form-label">类型</label>
						<div class="layui-input-inline">
							<input name="type" id="type" class="easyui-textbox" data-options="required:true,prompt:'请输入类型',missingMessage:'不能为空'">
						</div>
					</div>
				</div>
				<div class="layui-form-item" style="margin-top: 20px;">
					<div class="layui-inline">
						<label class="layui-form-label">计价方式</label>
						<div class="layui-input-inline">
							<input name="pricingMethod" class="easyui-combobox" data-options="
								valueField: 'label'
								,textField: 'value'
								,required:true
								,missingMessage:'不能为空'
								,prompt:'请选择'
								,data: [{
								    label: '计件',
								    value: '计件'
								},{
								    label: '计时',
								    value: '计时'
								},{
								    label: '按批',
								    value: '按批'
								}]
								,value: '计件'
								,onSelect: function(rec){
									if(rec.label == '计时'){
										$('#expectHours').numberbox({required:true});
									}else{
										$('#expectHours').numberbox({required:false});
									}
								}
								">
						</div>
					</div>
				</div>
				<div class="layui-form-item">
					<div class="layui-inline">
						<label class="layui-form-label">订单工序</label>
						<div class="layui-input-inline">
							<input id="orderProcessCode" name="orderProcessCode" class="easyui-combobox" data-options="required:true,valueField: 'code',textField: 'name',url:'manage/selectList/processList?type=订单',prompt:'请选择',missingMessage:'请选择'">
						</div>
					</div>
				</div>
				<div class="layui-form-item" style="margin-top: 20px;">
					<div class="layui-inline">
						<label class="layui-form-label">订单工序价格</label>
						<div class="layui-input-inline">
							<input name="orderPrice" class="easyui-numberbox" data-options="precision:2,min:0,required:true,prompt:'请输入订单工序价格',missingMessage:'不能为空'">
						</div>
					</div>
				</div>
				<div class="layui-form-item" style="margin-top: 20px;">
					<div class="layui-inline">
						<label class="layui-form-label">工序标准工时</label>
						<div class="layui-input-inline">
							<input id="expectHours" name="expectHours" class="easyui-numberbox" data-options="precision:2,min:0,prompt:'请输入工序标准工时',missingMessage:'不能为空'">
						</div>
					</div>
				</div>
			</form>
		</div>
	</div>
	<script type="text/javascript" th:inline="javascript">
		function getFormDataAndValidate(){
			var flag = $("#form").form('enableValidation').form('validate');
			if(!flag){
				return [false,{}];
			}
			var data = $('#form').serializeArray();
			var obj = new Object();
			$.each(data, function(index, e){
				obj[e.name] = e.value;
			})
			return [true,obj];
		}
	</script>
</body>
</html>